package test.jdk;

import com.alibaba.rocketmq.shade.com.alibaba.fastjson.JSON;

import java.util.function.Consumer;

public class User {

    private String name ;
    private int age ;

    //删掉这个会报错
    public User() {

    }

    public User(String name,int age){
        this.name=name;
        this.age=age;
    }

    public String getName() {
        return name;
    }

    public User setName(String name) {
        this.name = name;
        return this;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

    public void age(Consumer<Integer> com){
            com.accept(this.age);
    }

}
